home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
mechacatdestructo.swf
/
scripts
/
frame_7
/
PlaceObject2_316_1167
/
CLIPACTIONRECORD onClipEvent(load).as
Wrap
Text File
|
2007-10-01
|
6KB
|
250 lines
onClipEvent(load){
function mute()
{
SoundActive = false;
_global.Hud.Son.gotoAndStop(2);
}
function unmute()
{
SoundActive = true;
_global.Hud.Son.gotoAndStop(1);
}
function initGame(bPlayAgain)
{
Score = 0;
Life = 10;
Level = 1;
Time = 0;
gear = 0;
AmountLife = 1;
TotalScore = 0;
endStageScore = 0;
goToScreen("level" + Level,true);
resetTimer();
GameActive = true;
}
function endGame(endType)
{
GameActive = false;
_global.Game.G_Pause = true;
Score = _global.Game.Pers.Point;
if(endType == "lose")
{
TotalScore = Score;
goToScreen("Lose",true);
}
else
{
goToScreen("Win",true);
}
}
function reInitGame()
{
Score = 0;
Life = 10;
gear = 0;
TotalScore = 0;
endStageScore = 0;
goToScreen("level" + Level,true);
}
function levelUp()
{
Time = 0;
Level++;
_global.Transition.gotoAndStop("NextLevel");
NextScreen = "level" + Level;
Reset = true;
}
function resumeGame()
{
_global.Game.G_Resume = true;
}
function resetTimer()
{
Time = 0;
}
function increaseTime()
{
if(!_global.Game.G_Pause)
{
Time++;
}
TimeRemain = TotalTime - Time;
if(TimeRemain == 0)
{
endGame("lose");
}
refreshTime();
}
function TimeFlash()
{
if(TimeRemain <= 10)
{
if(_global.Hud.Minute._visible)
{
_global.Hud.Minute._visible = false;
_global.Hud.Seconde._visible = false;
_global.Hud.Seconde2._visible = false;
}
else
{
_global.Hud.Minute._visible = true;
_global.Hud.Seconde._visible = true;
_global.Hud.Seconde2._visible = true;
}
}
}
function refreshTime()
{
var _loc4_ = Math.floor(TimeRemain / 60);
var _loc3_ = TimeRemain % 60;
if(_loc3_ < 10)
{
var _loc2_ = "0" + String(_loc3_);
}
else
{
_loc2_ = String(_loc3_);
}
_global.Hud.Minute.text = _loc4_;
_global.Hud.Seconde.text = _loc2_.slice(0,1);
_global.Hud.Seconde2.text = _loc2_.slice(1,2);
}
function calculateBonus(bLoose)
{
TimeBonus = 0;
if(bLoose)
{
TimeBonus = 0;
}
else
{
TimeBonus = TimeRemain * 5;
TotalScore = TimeBonus + Score;
}
}
function refreshScore()
{
_global.theStage.xBonus.text = Score;
_global.theStage.timeBonus.text = TimeBonus;
_global.theStage.totalPoints.text = Score + TimeBonus;
}
function showHelp(inGame)
{
if(inGame)
{
GameActive = true;
_global.Game.G_Pause = true;
_global.Popup.gotoAndStop("Instructions");
}
else
{
GameActive = false;
_global.Popup.gotoAndStop("Instructions");
_global.theStage.gotoAndStop("Reset");
}
}
function helpBack()
{
_global.Popup.prevFrame();
}
function helpNext()
{
_global.Popup.nextFrame();
}
function goToScreen(Screen, ResetLevel)
{
_global.Transition.gotoAndStop("Transition");
NextScreen = Screen;
Reset = ResetLevel;
}
function resetScreen()
{
if(Reset)
{
_root.gotoAndStop("Reset");
}
_global.Popup.gotoAndStop(1);
}
function showScreen()
{
_global.theStage.gotoAndStop(NextScreen);
refreshTime();
if(NextScreen == "Lose" || NextScreen == "Win")
{
refreshScore();
}
else if(NextScreen.indexOf("level") != -1)
{
_global.Popup.gotoAndStop(Level + "Start");
}
}
function beginLevel()
{
_global.Popup.gotoAndStop(1);
_global.C.ActivateHud();
_global.Game.G_Resume = true;
}
function endLevel(CurrentPoint, CurrentLife)
{
Score = CurrentPoint;
_global.Popup.gotoAndStop(Level + "End");
SetResult();
}
function SetResult()
{
_global.Hud.Minute._visible = true;
_global.Hud.Seconde._visible = true;
_global.Hud.Seconde2._visible = true;
_global.Popup.collected_txt.text = gear;
calculateBonus(false);
var _loc4_ = Math.floor(TimeRemain / 60);
var _loc3_ = TimeRemain % 60;
if(_loc3_ < 10)
{
var _loc2_ = "0" + String(_loc3_);
}
else
{
_loc2_ = String(_loc3_);
}
_global.Popup.Minute.text = _loc4_;
_global.Popup.Seconde.text = _loc2_.slice(0,1);
_global.Popup.Seconde2.text = _loc2_.slice(1,2);
_global.Popup.Score_txt.text = TotalScore;
_global.Game.G_Pause = true;
gear = 0;
Life = 10;
endStageScore = TotalScore;
}
function endTransition()
{
_global.Transition.gotoAndStop(1);
}
function ActivateHud()
{
_global.Hud.btnHelp.enabled = true;
_global.Hud.Son.btnMute.enabled = true;
}
function DesactivateHud()
{
_global.Hud.btnHelp.enabled = false;
_global.Hud.Son.btnMute.enabled = false;
}
function getAgentID()
{
}
_global.C = this;
var Reset = false;
var Time = 0;
var gear = 0;
var AmountLife = 1;
var TotalTime = 420;
var TimeRemain = TotalTime;
var NextScreen = "";
var GameActive = false;
var SoundActive = true;
var TotalScore = 0;
var endStageScore = 0;
}